<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Document</title>
    <link rel="stylesheet" href="../css/api.css">
    <link rel="stylesheet" href="../css/news.css">
    <link rel="stylesheet" href="../css/aui_font.css">
    <link rel="stylesheet" href="../css/base_icon.css">
    <link rel="stylesheet" href="../css/swiper.css">
    <script src="../script/swiper.js"></script>
    <link rel="stylesheet" href="../css/frame1.css">
    <style>
        /* 轮播 */
        .swiper-slide {
            width: calc(100vw / 3 - 10px);
            position: relative;
        }

        .swiper-slide .label {
            position: absolute;
            bottom: 0;
            right: 0;
            background: rgba(255, 96, 152, 0.5);
            color: #fff;
            font-size: 10px;
            border-radius: 7px 0;
            padding: 0 7px;
        }

        .swiper-slide img {
            border-radius: 7px;
            width: 100%;
            height: 16vw;
            object-fit: cover;
        }

        /* 爱情故事 */
        .headtab {
            display: flex;
            padding: 10px 10px 0px 10px;
            align-items: center;
            justify-content: space-between;
        }

        .headtab .left {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .headtab .left img {
            width: 16px;
            margin-right: 6px;
        }

        .headtab .left span {
            font-size: 14px;
        }

        .headtab .right {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 12px;
            color: #999;
        }

        .pubbtn {
            width: 50px;
            position: fixed;
            bottom: 10vw;
            right: 7vw;
            z-index: 9999999;
        }

        /* 官方 */
        .sys-tag {
            background: #7ED0AE;
            color: #fff;
            border-radius: 15px;
            font-size: 10px;
            padding: 0 5px;
            margin-left: 5px;
        }
    </style>
</head>

<body>
    <div id="view" v-cloak>
        <img class="pubbtn" onclick="_url({ type: 0,},'frame1/fa_dong_tai')" src="../image/icon/icon_dynamic_issue.png" alt="">
        <header class="w-bg">
            <div class="m-swiper" v-if="lbList && lbList.length>0">
                <div class="swiper-container">
                    <div class="swiper-wrapper">
                        <div class="swiper-slide" v-for="(m, index) in lbList" :key="m.dy_id" :data-id="m.dy_id" onclick="openLove(this)">
                            <img v-if="m.video" :src="returnImg(m.cover)" onerror="this.src='../image/error-img.png'">
                            <img v-else :src="returnImg(m.sumbImage[0])" onerror="this.src='../image/error-img.png'">
                            <span class="label">{{m.slide_cate}}</span>
                        </div>
                    </div>
                    <div class="swiper-pagination"></div>
                </div>
            </div>
            <div class="headtab">
                <div class="left">
                    <img src="../image/dynamic/common_love_story_title_icon.png" alt="">
                    <span>Find爱情故事</span>
                </div>
                <div class="right" onclick="_url({}, 'frame1/lovemore')">
                    查看更多
                    <span class="aui-iconfont aui-icon-right"></span>
                </div>
            </div>
        </header>
        <ul class="dylist-wrap">
            <!-- 官方 -->
            <li class="list" v-for="(m, index) in sysList">
                <div class="list-container">
                    <div class="tx img-h" :class="{'xinren':m.is_new==1}" @click.stop @click="go_userInfo(m.id, m.name, m.sex)">
                        <img :src="returnImg(m.head_100)" onerror="this.src='../image/touxiang.png'" alt="">
                    </div>
                    <div class="left">
                        <div class="name-wrap">
                            <span class="name" :class="{'vip-name':m.noble_grade>0}">{{m.name}}</span>
                            <span class="sys-tag">官方</span>
                        </div>
                        <div class="dy-content-wrap">
                            <div class="dy-content">{{m.content}}</div>
                            <div class="img-wrap" :class="{moreimg: m.sumbImage.length>1}" v-if="m.sumbImage && m.sumbImage.length > 0 && m.sumbImage[0]">
                                <div class="img img-h" v-for="(s, sindex) in m.sumbImage" @click.stop="_url({imgArr:m.masterimg, iIndex:sindex}, 'frame1/dy_img_win')">
                                    <img :src="returnImg(s)" onerror="this.src='../image/error-img.png'" alt="">
                                </div>
                            </div>
                        </div>
                        <p class="time-wrap">
                            <span class="time">{{m.addtime}}</span>
                            <span class="time">浏览{{m.visit}}次</span>
                            <span class="area" v-if="m.citys">{{m.citys}}</span>
                        </p>
                        <!-- <div class="footer" v-if="!ios">
                            <div class="ul flex-bt">
                                <div class="left flex">
                                    <div class="li" @click.stop @click="zan(m.dy_id, index)">
                                        <i class="base-icon dy-nozan-icon" :class="{'dy-zan-icon':m.isthumbsup == 1}"></i>
                                        <span>{{m.num}}</span>
                                    </div>
                                    <div class="li">
                                        <i class="base-icon dy-comment-icon"></i>
                                        <span>{{m.comments ? m.comments : '评论'}}</span>
                                    </div>
                                    <div class="li" v-if="m.id != myuserid && !ios" @click.stop="shareDY(index)">
                                        <i class="base-icon dy-share-icon"></i>
                                        <span>转发</span>
                                    </div>
                                </div>
                            </div>
                        </div> -->
                    </div>
                </div>
            </li>
            <!-- 个人广播 -->
            <li class="list" v-for="(m, index) in ffList" @click="_url({id:m.dy_id, url:'frame1/dy_detail', title:'详情'})">
                <div class="list-container">
                    <div class="tx img-h" :class="{'xinren':m.is_new==1}" @click.stop @click="go_userInfo(m.id, m.name, m.sex)">
                        <img :src="returnImg(m.head_100)" onerror="this.src='../image/touxiang.png'" alt="">
                    </div>
                    <div class="left">
                        <div class="name-wrap">
                            <span class="name" :class="{'vip-name':m.noble_grade>0}">{{m.name}}</span>
                            <span class="boy-tag" :class="{'girl-tag':m.sex == '女'}">{{m.age}}</span>
                            <span class="new-tag man-ntag" :class="{'woman-ntag':m.sex=='女'}" v-if="m.realname_auth==2 && !ios"></span>
                            <span class="new-tag rz-tag" v-if="m.is_identity_authentication==2 && !ios"></span>
                            <span class="dy-more" @click.stop="more(index)"></span>
                        </div>
                        <div class="dy-content-wrap">
                            <div class="dy-content">{{m.content}}</div>
                            <div class="img-wrap" :class="{moreimg: m.sumbImage.length>1}" v-if="m.sumbImage && m.sumbImage.length > 0 && m.sumbImage[0]">
                                <div class="img img-h" v-for="(s, sindex) in m.sumbImage" @click.stop="_url({imgArr:m.masterimg, iIndex:sindex}, 'frame1/dy_img_win')">
                                    <img :src="returnImg(s)" onerror="this.src='../image/error-img.png'" alt="">
                                </div>
                            </div>
                            <div class="img-wrap dy-video" v-if="m.video">
                                <div class="img img-h" @click.stop="_url({ video: m.video, cover: m.cover, animationType: 0 }, 'frame0/liaotian_video')">
                                    <img :src="returnImg(m.cover)" onerror="this.src='../image/error-img.png'" alt="">
                                </div>
                            </div>
                        </div>
                        <p class="time-wrap">
                            <span class="time">{{m.addtime}}</span>
                            <span class="time">浏览{{m.visit}}次</span>
                            <span class="area" v-if="m.citys">{{m.citys}}</span>
                        </p>
                        <div class="footer" v-if="!ios">
                            <div class="ul flex-bt">
                                <div class="left flex">
                                    <div class="li" @click.stop @click="zan(m.dy_id, index)">
                                        <i class="base-icon dy-nozan-icon" :class="{'dy-zan-icon':m.isthumbsup == 1}"></i>
                                        <span>{{m.num}}</span>
                                    </div>
                                    <div class="li">
                                        <i class="base-icon dy-comment-icon"></i>
                                        <span>{{m.comments ? m.comments : '评论'}}</span>
                                    </div>
                                    <div class="li" v-if="m.id != myuserid && !ios" @click.stop="shareDY(index)">
                                        <i class="base-icon dy-share-icon"></i>
                                        <span>转发</span>
                                    </div>
                                </div>
                                <div class="hi-tag" :class="{'hi-tags':m.dashan==1}" v-if="m.id != myuserid && !ios" @click.stop="dashan(index, $event)">心动</div>
                            </div>
                        </div>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</body>
<script src="../script/api.js"></script>
<script src="../script/jquery.js"></script>
<script src="../script/ffkj.js"></script>
<script src="../script/vue.js"></script>
<script src="../script/frame1.js"></script>
<script src="../json/frame1.js"></script>
<script>
    var filterCity;
    var filterSex = 0; // 0 不限 1男 2女
    var filterNew = 1;
    var filterRecently = 0;
    var view = new Vue({
        el: '#view',
        data: {
            myuserid: '',
            imgurl: imgurl,
            ffList: [],
            ffInfo: {},
            lbList: [], // 轮播列表
            sysList: [], // 系统广播
            themeList: [], // 主题列表
            themeObj: {}, // 主题对象
            inputObj: {
                id: 0,
                uid: 0
            }, // 评论 广播id
            ios: 1, // 1上架 0非上架
        },

        methods: {
            // 转发
            shareDY(index) {
                shareDY(view.ffList[index]);
            },
            // 心动
            dashan(index, event) {
                var e = event.currentTarget;
                _dashan(index);
            },
            // 举报
            more(index) {
                more(index)
            },
            // 约会报名
            joinEnroll(id, index) {
                joinEnroll(id, index)
            },
            // 点赞
            zan(id, index, type) {
                zan(id, index, type)
            },
            // 评论
            addComment(dy_id, uid) {
                addComment(dy_id, uid)
            },
            // 发布评论
            send() {
                send()
            },
            _url(param, url) {
                _url(param, url);
            },
            // 返回图片路径
            returnImg(url) {
                return returnImg(url);
            },
            // 查看用户资料
            go_userInfo(id, name, sex) {
                go_userInfo(id, name, sex)
            },
            // 清除html
            clearHtml(s) {
                return clearHtml(s);
            }

        }
    })
    apiready = function() {
        view.ios = $api.getStorage('shang');
        view.myuserid = $api.getStorage('userid');

        // 监听登录
        _listener('fresh', function(ret) {
            view.myuserid = $api.getStorage('userid');
        })

        api.refreshHeaderLoadDone();
        _shangla(function() {
            getLoveStory();
            getSysDynamic();
            getData(0);
        })
        _scrollToBottom(function() {
            if (heigutgao == 1) {
                pagenum++;
                getData(pagenum)
            }
        })
    }

    // 获取数据
    function getData(page) {
        // var _city = filterCity == '不限地区' ? undefined : filterCity;

        var sex = $api.getStorage('sex') == '女' ? 2 : 1;
        var param = {
            userid: $api.getStorage('userid'),
            count: pagesize,
            longitude: $api.getStorage('lon'),
            latitude: $api.getStorage('lat'),
            type: 0,
            // sex: sex, // 性别筛选 0不限|1女性|2男性
            // citys: _city,
            // sex: filterSex,
            // new: filterNew,
            // recently: filterRecently,
        };
        var index = api.pageParam['index'];
        console.log(api.pageParam['index']);
        if (index == 1) {
            param.citys = $api.getStorage('appCity').c;
        }
        if (index == 3) {
            param.following = 1;
        }
        console.log(JSON.stringify(param))
        var loading = page == 0 ? 1 : 0;
        _lists('home/Dymanic/dymaniclst', page, loading, param);

    }
    // 获取爱情故事
    function getLoveStory() {
        _ajax('home/Dymanic/dymaniclst', function(ret, err) {
            if (ret && ret.code == 200) {
                var arr = ret.result;
                view.lbList = arr;
                setTimeout(function() {
                    var swiper = new Swiper('.swiper-container', {
                        loop: true,
                        speed: 2000,
                        slidesPerView: 3,
                        spaceBetween: 5,
                        autoplay: {
                            delay: 0,
                            disableOnInteraction: false,
                        },
                    });
                }, 1000)
            }
        }, {
            userid: $api.getStorage('userid'),
            count: pagesize,
            longitude: $api.getStorage('lon'),
            latitude: $api.getStorage('lat'),
            type: 1,
            slide: 1
        })
    }

    // 获取系统广播
    function getSysDynamic() {
        _ajax('home/dymanic/sysdymanic', function(ret, err) {
            if (ret && ret.code == 200 && ret.result && ret.result.length > 0) {
                view.sysList = ret.result;
            }
        })
    }

    // 打开爱情故事 轮播打开存在问题 故使用jq获取id
    function openLove(obj) {
        var id = $(obj).attr('data-id');
        _url({
            id: id,
        }, 'frame1/lovething')
    }
</script>

</html>